package com.lky.service.impl;

import com.lky.domain.NewUser;
import com.lky.domain.User;
import com.lky.mapper.UserMapper;
import com.lky.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 名称:UserServiceImpl
 * 描述:
 *
 * @version 1.0
 * @author:likaiyang
 * @datetime:2023-11-14 16:02
 */
@Service
@Primary
public class UserServiceImpl implements UserService {

    @Autowired(required = false)
    private UserMapper userMapper;

    @Override
    public User findUserById(Integer id) {
        return userMapper.findUserById(id);
    }

    @Override
    public List<User> findAllUser() {
        return userMapper.findAllUser();
    }

    @Override
    public int insertUser(User user) {
        return userMapper.insertUser(user);
    }

    @Override
    public int updateUserById(User user) {
        return userMapper.updateUserById(user);
    }

    @Override
    public int deleteUserById(Integer id) {
        return userMapper.deleteUserById(id);
    }


    //根据username获取User
    @Override
    public User findUserByNameAndPassword(User user) {
        return userMapper.findUserByNameAndPassword(user);
    }

    @Override
    public User findUserByName(User user) {
        return userMapper.findUserByName(user);
    }

    @Override
    public List<User> findUserByStr(String str) {
        return userMapper.findUserByStr(str);
    }

    @Override
    public int insertUser_new(User user) {
        return userMapper.insertUser_new(user);
    }

    @Override
    public int insertUserToNew_User(NewUser newuser) {
        return userMapper.insertUserToNew_User(newuser);
    }
}
